package others;

public class leetcode1249_minRemoveToMakeValid {
    public  static String minRemoveToMakeValid(String s) {
        int len = s.length() / 2;
        while (len > 0) {
            s = s.replace("()", "{}");
            len--;
        }
        s=s.replace("(", "");
        s=s.replace(")", "");
        s=s.replace("{}", "()");
        return s;
    }

    public static void main(String[] args) {
        System.out.println(minRemoveToMakeValid("lee(t(c)o)de)"));
    }
}